<?php
		$con = mysql_connect("localhost","root","");
				if (!$con)
				{
					die('Could not connect: ' . mysql_error());
				}

				mysql_select_db("rgfusion", $con);

				$result = mysql_query("SELECT * FROM companies");
				$a = mysql_query("SELECT * FROM categories");
				
				while($row = mysql_fetch_array($result))
				{
					$companyName = $row['companyName'];
					$companyCategory = $row['companyCategory'];
					$companyId = $row['companyId'];
					
					if($companyId == 0)
								{
								
									$companyName .= '<a href = "category.php?categoryId=' . $categoryId . '&companyId=' . $row["companyId"] . '">' .
									htmlentities($row["companyName"], ENT_COMPAT, "ISO-8859-1") . '</a> <br />';
								
								}
					
						if($row = mysql_fetch_array($a))
						{
							$categoryId = $row['categoryId'];
							$categoryType = $row['categoryType'];
							if($companyCategory == $categoryId)
							{
							?>
								<a href = 'category.php?categoryId=<?=$row["categoryId"]?>'> <?=$categoryType?> </a>
							<?php
							}
							
								
						}
				}
				
				
					
					
					
				
?>